#ifndef MG_TLC59116_H
#define MG_TLC59116_H

#include "ite/itp.h" //for all ith driver (include GPIO) & MACRO
#include <sys/ioctl.h>
#include <unistd.h>
#include "mg_iic.h"
#include "string.h"


#define TLC59116_RST_Pin		14

#define TLC59116_LED_DEVICE_ADDR	0x60  //设备地址
#define TLC59116_ALL_CALL_ADDR		0X68  //广播地址
#define TLC59116_RST_ADDR			0X6B  //软件复位地址
/**********************************寄存器表**************************************/
/*		寄存器名称			寄存器地址		备注								*/
#define TLC59116_LEDMODE1	0X00			//模式1
#define TLC59116_LEDMODE2	0X01			//模式2
#define TLC59116_LEDPWM0	0X02			//亮度控制LED0
#define TLC59116_LEDPWM1	0X03			//亮度控制LED1
#define TLC59116_LEDPWM2	0X04			//亮度控制LED2
#define TLC59116_LEDPWM3	0X05			//亮度控制LED3
#define TLC59116_LEDPWM4	0X06			//亮度控制LED4
#define TLC59116_LEDPWM5	0X07			//亮度控制LED5
#define TLC59116_LEDPWM6	0X08			//亮度控制LED6
#define TLC59116_LEDPWM7	0X09			//亮度控制LED7
#define TLC59116_LEDPWM8	0X0A			//亮度控制LED0
#define TLC59116_LEDPWM9	0X0B			//亮度控制LED1
#define TLC59116_LEDPWM10	0X0C			//亮度控制LED2
#define TLC59116_LEDPWM11	0X0D			//亮度控制LED3
#define TLC59116_LEDPWM12	0X0E			//亮度控制LED4
#define TLC59116_LEDPWM13	0X0F			//亮度控制LED5
#define TLC59116_LEDPWM14	0X10			//亮度控制LED6
#define TLC59116_LEDPWM15	0X11			//亮度控制LED7
#define TLC59116_GRPPWM		0X12			//集体占空比控制
#define TLC59116_GRPFREQ	0x13			//组频率
#define TLC59116_LEDOUT0	0X14			//LED输出状态0
#define TLC59116_LEDOUT1	0X15			//LED输出状态1
#define TLC59116_LEDOUT2	0X16			//LED输出状态2
#define TLC59116_LEDOUT3	0X17			//LED输出状态3


//控制单个Led
void TLC59116_Set_SingleLed(uint8_t Led_Num, uint8_t PWM);
//所有SinglePwm设置
void TLC59116SetAllPWMSame(uint8_t duty);
//所有SinglePwm设置(不同值)
void TLC59116SetAllPWM(uint8_t* duty);
//RGB驱动初始化
uint32_t TLC59116_Init(void);

#endif